<SCRIPT LANGUAGE="JavaScript">
// JavaScript Document
function updateRadio (val) 
{
	if(teamMembers["driverSelect[]"][val].checked == true && 
	   teamMembers.captainSelect[val].disabled == true ) 
	{
		teamMembers.captainSelect[val].disabled=false;
	}
	else if(teamMembers["driverSelect[]"][val].checked == false)
	{
		teamMembers.captainSelect[val].disabled=true;
		teamMembers.captainSelect[val].checked=false;
	}
}

function validateParams (minDrivers, maxDrivers) 
{
	captain = -1;
	for (i = 0; i < teamMembers.captainSelect.length && captain == -1; i++)
	{
		if(teamMembers.captainSelect[i].checked && !teamMembers.captainSelect[i].disabled)
			captain = i;
	}
	if(captain == -1)
	{
		window.alert("You must select a captain.");
		return false;
	}
	
	count = 0;
	for (i = 0; i < teamMembers["driverSelect[]"].length; i++)
	{
		if(teamMembers["driverSelect[]"][i].checked)
			count++;
	}
	if(count < minDrivers)
	{
		var message = "<?= $lang['UserCPMultiEntryDriversMin'] ?>";
		window.alert( message.replace(/{minDrivers}/g, minDrivers));
		return false;
	}
	if(count > maxDrivers)
	{
		var message = "<?= $lang['UserCPMultiEntryDriversMax'] ?>";
		window.alert( message.replace(/{maxDrivers}/g, maxDrivers));
		return false;
	}
	
	return confirm('<?= $lang['Confirm'] ?>');
}
</SCRIPT>
<form name="teamMembers" action="<?= $action ?>" method="post" onsubmit="return validateParams(<?= $minDrivers?>,<?= $maxDrivers?>)">
<input name="champid" type="hidden" value="<?= $champid ?>">
<input name="currentCaptain" type="hidden" value="<?= $orgCaptain ?>">
<table class="contentTable" border="0">
  <tr>
    <td class="tableHeadingLeft">&nbsp;</td>
    <td class="tableHeadingLeft"><?= $lang['Drivers']?></td>
    <td class="tableHeadingLeft"><?= $lang['TeamCaptain']?></td>
  </tr>